<template>
    <div class="m1">
        <div class="result">

            <el-form ref="form" :model="resultForm" label-width="80px" >
                <div class="tResult">
                    <el-form-item label="电话号码:" class="phone" placeholder="请输入注册电话" >
                        <el-input v-model="resultForm.phone" ref="phone"></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-button type="primary" @click="onSubmit()">查看</el-button>
                    </el-form-item>
                </div>
            </el-form>
        </div>
        <div>
            <el-dialog
                    title="审核结果"
                    :visible.sync="dialogVisible"
                    :data="resultInfo"
                    width="30%"
            >
                <el-form ref="form" :model="resultInfo" label-width="80px" class="info">

                    <el-form-item label="姓名:">
                        <span class="infoAttribute">{{resultInfo.name}}</span>
                    </el-form-item>
                    <el-form-item label="电话:">
                        <span class="infoAttribute">{{resultInfo.phone}}</span>
                    </el-form-item>
                    <el-form-item label="状态:">
                        <span v-show="resultInfo.status===0" >审核通过</span>
                        <span v-show="resultInfo.status===1" >禁用</span>
                        <span v-show="resultInfo.status===2" >审核未通过</span>
                        <span v-show="resultInfo.status===3" >待审核</span>
                    </el-form-item>
                    <el-form-item label="审核意见:">
                        <span class="infoAttribute">{{resultInfo.opinion}}</span>
                    </el-form-item>
                </el-form>
                <span slot="footer" class="dialog-footer">
                    <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
                </span>
            </el-dialog>
        </div>
    </div>
</template>

<script>
    export default {
        name: "Re-applyResult",
        data(){
            return{
                resultForm:{},
                dialogVisible:false,
                resultInfo:"",
            }
        },
        methods:{
            onSubmit(){
                let vm= this;
                this.$http.get(`/core/teacher/selApplyByPhone/${this.$refs.phone.value}`).then(function (resp) {
                    if (resp.data.code === 2000){
                        vm.dialogVisible = true;
                        /*vm.$set(resp.data.result.status,0,"待审核")*/
                        vm.resultInfo = resp.data.result;
                        vm.$message.success(resp.data.msg);
                    }else{
                        vm.$message.error(resp.data.msg);
                    }

                })
            }
        }

    }
</script>

<style>
    .m1{
        width: 350px;
        display: block;
        text-align: center;
    }
   .el-form{
       margin-top: 70px;
       position: relative;
       left:275px;
       top:20px
   }
    .result{

    }
    .info{
        position: relative;
        left: 0px;
    }
    .el-form.info{
        margin-top: 0;
    }
    .infoAttribute{
        background-color: white;
        color: black;

    }

</style>